package com.peanut.youfupay.service.must;


import com.alibaba.fastjson.JSON;
import com.peanut.youfupay.entity.request.Payment;
import com.peanut.youfupay.entity.response.PaymentTransRes;
import com.peanut.youfupay.entity.response.ResponseMessage;
import com.peanut.youfupay.enums.FunCodeEnum;
import com.peanut.youfupay.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 商户批量付款
 *
 * @author peanut
 */
@Slf4j
@Service("paymentService")
public class PaymentService extends BaseService {
    /**
     * @param funCodeEnum
     * @param payment
     * @return
     * @throws Exception
     */
    public PaymentTransRes doBusiness(FunCodeEnum funCodeEnum, Payment payment) {
        log.info("付款开始:{}，{}", funCodeEnum, payment);
        ResponseMessage responseMessage = applyYouFuByHttpPost(funCodeEnum, payment);
        PaymentTransRes paymentTransRes = JSON.parseObject(responseMessage.getResData(), PaymentTransRes.class);
        log.info("付款结束:{}", paymentTransRes);
        return paymentTransRes;
    }
}





